﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo01
{
    /*1. 定义一个用户类，存放用户的账号、用户名和密码属性；
    2. 在用户类中定义一个方法输出当前用户对象的账号、用户名和密码的信息；然后在主方法调用输出；*/
    class Program
    {
        static void Main(string[] args)
        {
            User userLilly = new User(123,"lilly","456");
            userLilly.Tell();
            userLilly.UserName = "nicola";
            userLilly.UserNo = 1234;
            userLilly.Password = "4567";
            userLilly.Tell();
            Console.ReadKey();
        }
    }

    class User
    {
        private int userNo;
        private string userName;
        private string password;

        public User(int userNo, string userName, string password)
        {
            this.userNo = userNo;
            this.userName = userName;
            this.password = password;
        }

        public User() { }

        public int UserNo
        {
            get { return userNo; }
            set { userNo = value; }
        }

        public string UserName 
        {
            get { return userName; }
            set { userName = value; }
        }

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        public void Tell()
        {
            Console.WriteLine("当前用户的账号是{0}、用户名是{1}，" +
                "密码是{2}",this.userNo,this.userName,this.password);
        }
    }
}
